<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我的订单</title>
    <link rel="stylesheet" href="../css/weui.css">
    <link rel="stylesheet" href="../css/dropload.css">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />

</head>
<style>
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body,
    html {
        width: 100%;
        background: #f0f0f0;
    }

    header {
        text-align: center;
        height: 44px;
        line-height: 44px;
        border-bottom: 0.5px solid #bbbbbb;
        position: relative;
        background: #fff;
    }

    .list {
        background: #fff;
        padding: 10px;
        font-size: 14px;
        margin-top: 5px;
        width: calc(100% - 76px - 110px - 5px);
        border-right: 1px solid #ccc;
    }

    .list a {
        font-size: 12px;
        color: #fff;
        background-size: 100% 100%;
        background-image: url('../images/btn1.png');
        background-position: 0 0;
        background-repeat: no-repeat;
        padding: 5px 15px;
        outline: none;
        background-color: rgba(0, 0, 0, 0);
    }

    .time {
        font-size: 12px;
        color: #717171
    }

    .name {

        color: #717171;
    }

    html {
        padding-bottom: 53px;
    }

    .weui-tab {
        position: fixed;
        bottom: 0;
        height: auto;
        width: 100%;
        z-index: 88;
    }

    .weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon,
    .weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon>i,
    .weui-tabbar__item.weui-bar__item_on .weui-tabbar__label {
        color: #348afd;
    }

    .weui-tab__panel {
        display: none;
    }

    .block {
        display: block;
    }

    .weui-tabbar__item>img {
        padding: 2px;
        border-radius: 0px;
    }

    .weui-tabbar__item>p {
        font-size: 12px;
    }

    .listbox {
        background: #fff;
        font-size: 0;
        padding: 10px 0;
        margin-bottom: 10px;
    }

    .listbox>img {
        display: inline-block;
        vertical-align: middle;
        width: 76px;
        padding: 10px;
        margin-left: 5px;
    }

    .list {
        display: inline-block;
        vertical-align: middle;
    }

    .listbox>span {
        width: 110px;
        display: inline-block;
        vertical-align: middle;
        font-size: 16px;
        text-align: center;
    }

    .listbox>span>a {
        color: #1197ff;
    }

    .listbox_title {
        font-size: 12px;
        color: #fff;
    }

    .listbox_title>span {
        background: #1197ff;
        padding: 3px 10px;
        border-radius: 0 1000px 1000px 0;
    }

    .yuanyin {
        color: #1197ff;
        line-height: 38px;
    }
</style>

<body>
    <div class="list_boxx">

    </div>
    <div class="weui-tab">
        <div class="weui-tabbar">
            <a href="guanyu.html" class="weui-tabbar__item ">
                <img src=".././images/guanyuicont.png" data-oldsrc=".././images/guanyuicont.png" data-newsrc=".././images/newguanyuicont.png"
                    alt="" class="weui-tabbar__icon">
                <p class="weui-tabbar__label">关于海贷</p>
            </a>
            <a href="haidaichanpin.html" class="weui-tabbar__item">
                <img src=".././images/gengduo.png" data-oldsrc=".././images/gengduo.png" data-newsrc=".././images/newgengduo.png"
                    alt="" class="weui-tabbar__icon">
                <p class="weui-tabbar__label">海贷产品</p>
            </a>
            <a href="dingfan.html" class="weui-tabbar__item weui-bar__item_on">
                <img src=".././images/newdingdan.png" data-oldsrc=".././images/dingdan.png" data-newsrc=".././images/newdingdan.png"
                    alt="" class="weui-tabbar__icon">
                <p class="weui-tabbar__label">我的订单</p>
            </a>
            <a href="wode.html" class="weui-tabbar__item  ">
                <img src=".././images/geren.png" data-oldsrc=".././images/geren.png" data-newsrc=".././images/newgeren.png"
                    alt="" class="weui-tabbar__icon">
                <p class="weui-tabbar__label">我的</p>
            </a>
        </div>
    </div>
    <script src="../js/jquery-3.2.1.min.js"></script>
    <script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
    <script src="../js/dropload.min.js"></script>
    <script>
        var dingdanindex = localStorage.getItem('dingdan');
        if (dingdanindex == null || dingdanindex == undefined) {
            localStorage.setItem('dingdan', 0)
        }
        setInterval(function () {
            var dingdanindex = localStorage.getItem('dingdan');
            if (dingdanindex == 1) {
                localStorage.setItem('dingdan', 0)
                location.reload()
            }
        }, 0)
        var http = localStorage.getItem('http')
        var UserId = localStorage.getItem('UserId')
        var Access_token = localStorage.getItem('Access_token')
        var Refresh_token = localStorage.getItem('Refresh_token');
        pageIndex = 0;
        pageSize = 10;
        wenti = ''
        // url: http + "/api/prosprct/OrderList?keyValue="+UserId+'&'+"pageParameter.pageIndex="+pageIndex+'&pageParameter.pageSize='+pageSize,
        console.log(pageSize)
        $('body').dropload({
            scrollArea: window,
            loadDownFn: function (me) {
                pageIndex++
                $.ajax({
                    type: 'GET',
                    headers: {
                        "Authorize": Access_token + '|' + Refresh_token,
                        "MemberId": UserId
                    },
                    url: http + "/api/prosprct/OrderList",
                    async: false,
                    data: {
                        "keyValue": UserId,
                        "pageIndex": 1,
                        "pageSize": 4
                    },
                    dataType: "json",
                    success: function (data) {
                        console.log(JSON.stringify(data))
                        if (data.type == 1) {
                            for (var i = 0; i < data.resultdata.Rows.length; i++) {
                                if(data.resultdata.Rows[i].ModificationProgressState!=null){
                                $.ajax({
                                    type: 'GET',
                                    headers: {
                                        "Authorize": Access_token + '|' + Refresh_token,
                                        "MemberId": UserId
                                    },
                                    url: http + '/api/declaration/GetCause?keyValue=' + data.resultdata.Rows[i].ProductAppId,
                                    async: false,
                                    data: {},
                                    dataType: "json",
                                    success: function (data) {
                                        console.log(JSON.stringify(data))
                                        if (data.type == 1) {
                                            wenti = data.resultdata
                                        }
                                    },
                                    error: function (err) {
                                        console.log(data.resultdata.Rows[i].ProductAppId)
                                        console.log(JSON.stringify(err))
                                    }
                                })
                                }
                                console.log(data.resultdata.Rows[i].SerialNumber);
                                var zhuangtai = '';
                                if (data.resultdata.Rows[i].Status != 1) {
                                    if (data.resultdata.Rows[i].ModificationProgressState != null) {
                                        if (data.resultdata.Rows[i].ModificationProgressState == 4) {
                                        zhuangtai = '待修改<div class="yuanyin">查看问题</div>'
                                        }else if (data.resultdata.Rows[i].ModificationProgressState == 10) {
                                        zhuangtai = '待修改<div class="yuanyin">查看问题</div>'
                                        }else if (data.resultdata.Rows[i].ModificationProgressState == 13) {
                                        zhuangtai = '待修改<div class="yuanyin">查看问题</div>'
                                        }else{
                                        zhuangtai = '待修改'

                                        }
                                    } else {
                                        if (data.resultdata.Rows[i].CurrentProgressState == 0) {
                                            zhuangtai = '订单开始'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 1) {
                                            zhuangtai = '等待初评'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 2) {
                                            zhuangtai = '已初评'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 3) {
                                            zhuangtai = '待分配'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 4) {
                                            zhuangtai = '等待下户'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 5) {
                                            zhuangtai = '待价值认定'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 6) {
                                            zhuangtai = '待一审'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 7) {
                                            zhuangtai = "待终审"
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 8) {
                                            zhuangtai = '待复核'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 9) {
                                            zhuangtai = '待公正分配'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 10) {
                                            zhuangtai = '等待公证'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 11) {
                                            zhuangtai = '待公正审核'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 12) {
                                            zhuangtai = '待抵押分配'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 13) {
                                            zhuangtai = '等待抵押'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 14) {
                                            zhuangtai = '待抵押审核'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 15) {
                                            zhuangtai = '待收费确认'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 16) {
                                            zhuangtai = '待放款'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 17) {
                                            zhuangtai = '已放款'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 18) {
                                            zhuangtai = '已归档'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 19) {
                                            zhuangtai = '待解押'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 20) {
                                            zhuangtai = '已解押'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 21) {
                                            zhuangtai = '订单结束'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 22) {
                                            zhuangtai = '已拒绝 <div class="yuanyin">查看问题</div>'
                                        }
                                    }
                                } else {
                                    if (data.resultdata.Rows[i].ModificationProgressState != null) {
                                        if (data.resultdata.Rows[i].ModificationProgressState != null) {
                                            if (data.resultdata.Rows[i].ModificationProgressState == 4) {
                                                zhuangtai = '<a href="wodedingdan/dingdanxinxi.html?id=' +
                                                    data.resultdata.Rows[i].ProductAppId + '&SerialNumber=' +
                                                    data.resultdata.Rows[i].SerialNumber + '">待修改</a><div class="yuanyin">查看问题</div>'
                                            } else if (data.resultdata.Rows[i].ModificationProgressState == 10) {
                                                zhuangtai = '<a href="./wodedingdan/gonzgheng.html?id=' +
                                                    data.resultdata.Rows[i].ProductAppId + '&SerialNumber=' +
                                                    data.resultdata.Rows[i].SerialNumber + '">待修改</a><div class="yuanyin">查看问题</div>'
                                            } else if (data.resultdata.Rows[i].ModificationProgressState == 13) {
                                                zhuangtai = '<a href="./wodedingdan/diya.html?id=' + data.resultdata
                                                    .Rows[i].ProductAppId + '&SerialNumber=' + data.resultdata
                                                        .Rows[i].SerialNumber + '">待修改</a><div class="yuanyin">查看问题</div>'
                                            } else {
                                                zhuangtai = '待修改'
                                            }
                                        }
                                    } else {
                                        if (data.resultdata.Rows[i].CurrentProgressState == 0) {
                                            zhuangtai = '订单开始'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 1) {
                                            zhuangtai = '等待初评'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 2) {
                                            zhuangtai = '<a href="./wodedingdan/baodan.html?id=' + data.resultdata.Rows[i].ProductAppId + '&SerialNumber=' + data.resultdata.Rows[i].SerialNumber + '">已初评</a>'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 3) {
                                            zhuangtai = '待分配'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 4) {
                                            zhuangtai = '<a href="wodedingdan/dingdanxinxi.html?id=' +
                                                data.resultdata.Rows[i].ProductAppId + '&SerialNumber=' +
                                                data.resultdata.Rows[i].SerialNumber + '">等待下户</a>'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 5) {
                                            zhuangtai = '待价值认定'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 6) {
                                            zhuangtai = '待一审'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 7) {
                                            zhuangtai = "待终审"
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 8) {
                                            zhuangtai = '待复核'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 9) {
                                            zhuangtai = '待公正分配'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 10) {
                                            zhuangtai = '<a href="./wodedingdan/gonzgheng.html?id=' +
                                                data.resultdata.Rows[i].ProductAppId + '&SerialNumber=' +
                                                data.resultdata.Rows[i].SerialNumber + '">等待公证</a>'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 11) {
                                            zhuangtai = '待公正审核'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 12) {
                                            zhuangtai = '待抵押分配'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 13) {
                                            zhuangtai = '<a href="./wodedingdan/diya.html?id=' + data.resultdata
                                                .Rows[i].ProductAppId + '&SerialNumber=' + data.resultdata
                                                    .Rows[i].SerialNumber + '">等待抵押</a>'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 14) {
                                            zhuangtai = '待抵押审核'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 15) {
                                            zhuangtai = '待收费确认'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 16) {
                                            zhuangtai = '待放款'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 17) {
                                            zhuangtai = '已放款'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 18) {
                                            zhuangtai = '已归档'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 19) {
                                            zhuangtai = '待解押'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 20) {
                                            zhuangtai = '已解押'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 21) {
                                            zhuangtai = '订单结束'
                                        } else if (data.resultdata.Rows[i].CurrentProgressState == 22) {
                                            zhuangtai = '已拒绝<div class="yuanyin">查看问题</div>'
                                        }
                                    }
                                }

                                localStorage.setItem('NAME', data.resultdata.Rows[i].Name)
                                $('.list_boxx')[0].innerHTML +=
                                    `
                                        <div class="listbox">
            <div class="listbox_title">
                <span style="        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;">海贷抵押</span>
            </div>
            <img src="../images/dindgantouxiang.png" alt="">
            <div class="list">
                <div>订单编号：
                    <span style="        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;">${data.resultdata.Rows[i].SerialNumber}</span>
                </div>
                <div class="name">姓名：
                    <span>${data.resultdata.Rows[i].Name}</span>
                </div>
            </div>
            <span uist="${wenti}">
                ${zhuangtai}
            </span>
        </div>
                                `
                                $('.yuanyin').click(function () {

                                    alert($(this).parent().attr('uist'))
                                })
                            }
                            if (pageIndex > data.resultdata.Total) {
                                // 锁定
                                me.lock();
                                me.noData();
                                $('.dropload-down').append(`<div class="dropload-noData">暂无数据</div>`)
                            }
                            if (pageIndex <= data.resultdata.Total) {
                                // 锁定
                                me.lock();

                                me.noData();
                                $('.dropload-down').append(`<div class="dropload-noData">暂无数据</div>`)
                            }
                            me.resetload();
                        } else {
                            // 锁定
                            me.lock();
                            me.noData();
                            $('.dropload-down').append(`<div class="dropload-noData">暂无数据</div>`)
                        }
                    },
                    error: function (err) {
                        console.log(JSON.stringify(err))
                        // 锁定
                        me.lock();
                        me.noData();
                        $('.dropload-load').html(`<div class="dropload-noData">获取错误</div>`)
                    }
                })
            }
        });
    </script>
</body>

</html>